var t=setInterval(function(){},1000);
clearInterval(t);
var t=setTimeout(function(){},1000);
clearTimeout(t);

function timeout(action,time){
	let clock=setInterval(()=>{
		action();
		clearInterval(clock);
	},time);
	return clock;
}

function cancelTiming(timer){
	clearInterval(timer);
}

function interval(action,time,name){
	if(window.timers==undefined){
		window.timers=[];
	}
	window.timers[name]=setTimeout(function(){
		action();
		interval(action,time,name);
	},time);
	return name;
}

function stopTiming(timer){
	clearTimeout(window.timers[timer]);
}
